Skip to content

Conversation

Dimi1010
Copy link
Collaborator

In relation to #1916 (comment).

This PR adds a short description on ProtocolType and ProtocolTypeFamily usage in a separate doxygen "topic" page.

Note: The paragraphs enclosed inside the @internal and @endinternal scope, will not generate any documentation unless doxygen is ran with INTERNAL_DOCS=YES. As the section there relates to the internal mechanics and can be subject to change, I decided it is best not to specify it directly in public documentation, to avoid users of the library relying on the information.

@Dimi1010 Dimi1010 marked this pull request as ready for review August 13, 2025 15:32
@Dimi1010
Copy link
Collaborator Author

Do tell if there are any suggestions on expanding the section.

Copy link

codecov bot commented Aug 13, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.47%. Comparing base (8e3896b) to head (0b98813).
⚠️ Report is 1 commits behind head on dev.

Additional details and impacted files
@@           Coverage Diff            @@
##              dev    #1919    +/-   ##
========================================
  Coverage   83.47%   83.47%            
========================================
  Files         298      298            
  Lines       53950    53950            
  Branches    11990    11982     -8     
========================================
  Hits        45034    45034            
+ Misses       8242     7705   -537     
- Partials      674     1211   +537     
Flag Coverage Δ
alpine320 75.44% <ø> (ø)
fedora42 75.56% <ø> (ø)
macos-13 81.66% <ø> (ø)
macos-14 81.66% <ø> (ø)
macos-15 81.66% <ø> (ø)
mingw32 70.30% <ø> (+<0.01%) ⬆️
mingw64 70.27% <ø> (-0.02%) ⬇️
rhel94 75.29% <ø> (+0.02%) ⬆️
ubuntu2004 59.21% <ø> (+0.02%) ⬆️
ubuntu2004-zstd 59.29% <ø> (-0.03%) ⬇️
ubuntu2204 75.20% <ø> (-0.01%) ⬇️
ubuntu2204-icpx 60.90% <ø> (ø)
ubuntu2404 75.44% <ø> (ø)
ubuntu2404-arm64 75.43% <ø> (ø)
unittest 83.47% <ø> (ø)
windows-2022 85.48% <ø> (ø)
windows-2025 85.49% <ø> (ø)
winpcap 85.49% <ø> (ø)
xdp 52.97% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

/// ProtocolTypeFamily parameter is expected, a single ProtocolType value can be passed instead. The library will
/// treat it as a family containing only that single protocol.
///
/// @internal
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I'm not sure this section should be defined as @internal

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I marked it as such, as I think it would be beneficial for those 2 typedefs to be converted to actual structs for type safety eventually.

The current issue with that is their usages in switch statemets. To use a structure in a case XXX: stmt requires the structure to be castable to integral type at compile time. To do this would require all protocol definitions to be constexpr variables, which has some issues when in headers pre-cpp17.

This is why I put that section as internal documentation.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have a strong opinion, just thought this information could be useful for everyone using this library, not just its developers. If you feel strongly about keeping it, I'm ok with it too 🙂

The PR is ready to merge, so whatever you think...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm gonna keep it internal for now. We can publish more documentation on it if we move to discrete types instead of aliases. As is, the users shouldn't really depend on any internal relations on how it works, as the actual public use cases for ProtocolType and ProtocolTypeFamily are as a more complicated Enum tbh.

/// @brief The main namespace for the PcapPlusPlus lib
namespace pcpp
{
/// @defgroup ProtocolTypes ProtocolType and ProtocolTypeFamily
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better if we could do the check using the compiler, but if not, we reviewers need to read the code carefully.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be, but we need cpp17 for that.

@Dimi1010 Dimi1010 merged commit b25fb59 into seladb:dev Aug 14, 2025
42 checks passed
@Dimi1010 Dimi1010 deleted the docs/protocol-type-docs branch August 14, 2025 10:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants